package org.ewaf.framework.exception;


/**
 * 业务逻辑异常
 */
public class BizException extends RuntimeException {

	private static final long serialVersionUID = 4524632967825015383L;

	private final Enum<?> errorCode;
	private final Object[] parameters;
	
	/**
	 * @param errorCode 错误代码
	 * @param parameters 错误信息相关参数
	 */
	public BizException(Enum<?> errorCode, Object... parameters) {
		this.errorCode = errorCode;
		this.parameters = parameters;
	}
	
	public BizException(Enum<?> errorCode) {
		this(errorCode, (Object[]) null);
	}
	


	public Enum<?> getErrorCode() {
		return errorCode;
	}
	
	public Object[] getParameters() {
		return parameters;
	}

	public String toString() {
		return errorCode.toString();
	}

	public String getMessage()
	{
		return this.toString();
	}
	
}